﻿using System;
using System.Collections.Generic;
using System.Text;
using XCore.Authorization;

namespace SaaS.Core.Authorization
{
    public class PermissionBlogProvider : AuthorizationProvider
    {
        public override void SetPermissions(IPermissionDefinitionContext context)
        {
            var blog = context.CreatePermission(PermissionNames.Blog, "博客管理");

            var menu = blog.CreateChildPermission(PermissionNames.Blog_Menu, "菜单管理");
            menu.CreateChildPermission(PermissionNames.Blog_Menu_Create, "创建");
            menu.CreateChildPermission(PermissionNames.Blog_Menu_Edit, "编辑");
            menu.CreateChildPermission(PermissionNames.Blog_Menu_Delete, "删除");

            var article = blog.CreateChildPermission(PermissionNames.Blog_Article, "文章管理");
            article.CreateChildPermission(PermissionNames.Blog_Article_Create, "创建");
            article.CreateChildPermission(PermissionNames.Blog_Article_Edit, "编辑");
            article.CreateChildPermission(PermissionNames.Blog_Article_Delete, "删除");
        }
    }
}
